<template>
  <div>

    <Table stripe :columns="columns" :data="data"></Table>

    <row style="margin-top: 10px">
      <i-col align="right">
        <Page show-sizer :total="total" show-total @on-change="onChange" @on-page-size-change="onPageSizeChange"/>
      </i-col>
    </row>

  </div>
</template>

<script>
  import {SpringFindAll} from "../../../api/data"

  export default {
    data() {
      return {
        page: 1,//page 第几页
        pageSize: 10,//pageSize:每页几条数据
        total: 0,
        columns: [
          {
            title: '代码',
            key: 'code'
          },
          {
            title: '名称',
            key: 'name'
          },
        ],
        data: []
      }
    },
    mounted() {
      this.SpringFindAll();

    },
    methods: {
      SpringFindAll() {
        var data = {
          page: this.page,
          pageSize: this.pageSize,
        };
        SpringFindAll(data).then(data => {
          if (data.data.code == 0) {
            this.data = data.data.data.list;
            this.total = data.data.data.total;
          }
        })
      },

      onPageSizeChange(pageSize) {
        this.page = 1;
        this.pageSize = pageSize;
        this.SpringFindAll();
      },
      onChange(page) {
        this.page = page;
        this.SpringFindAll();
      },
    }
  }
</script>

<style lang="less">

</style>

